package com.hongshan.wallet.util

import com.hongshan.wallet.Constant
import com.hongshan.wallet.MyApplication
import com.hongshan.wallet.router.RouterIndex
import com.hongshan.wallet.router.go
import com.hongshan.wallet.toast

/**
 * Copyright Zhangxx.
 * Copyright (c) 2019
 * All rights reserved
 *
 * @project  : Wallet
 * @package  : com.example.wallet.util
 * @author   : zhangxx
 * @date     : 2019/4/12
 * @email    : qq957413212@hotmail.com
 * @desc     : //TODO
 */
fun checkRealNameAndPwdStatus() = checkRealName()|| checkPwd()

fun checkPwd(): Boolean {
    if (MyApplication.userInfo.get()?.pay_password == "no") {
        toast("请先设置支付密码")
        goSetPwd()
        return true
    }
    return false
}

fun checkRealName(): Boolean {
//    if (MyApplication.userInfo.get()?.real_name == "no") {
//        toast("请先进行实名认证")
//        go(
//            RouterIndex.REAL_NAME,
//            mapOf(Constant.ROUTE_PARAMS_KEY.REAL_NAME_ACTION to Constant.ROUTE_PARAMS_KEY.ACTION_SET_REAL_NAME)
//        )
//        return true
//    }
    return false
}

fun goSetPwd() {
    val params = mapOf(
        Constant.ROUTE_PARAMS_KEY.SMS_NEXT_URL to RouterIndex.VERIFICATION_PWD,
        Constant.ROUTE_PARAMS_KEY.SMS_TITLE to "手机验证",
        Constant.ROUTE_PARAMS_KEY.SMS_BUTTON to "下一步",
        Constant.ROUTE_PARAMS_KEY.SMS_ACTION to Constant.ROUTE_PARAMS_KEY.ACTION_CHECK_PAY_PWD,
        Constant.ROUTE_PARAMS_KEY.VERFIFCATION_PWD_NEED_AGAIN to true,
        Constant.ROUTE_PARAMS_KEY.VERFIFCATION_PWD_NEED_FINISH to true,
        Constant.ROUTE_PARAMS_KEY.VERFIFCATION_ACTION to Constant.ROUTE_PARAMS_KEY.ACTION_SET_PAY_PWD,
        Constant.ROUTE_PARAMS_KEY.VERFIFCATION_PWD_DESC to "请输入六位数字支付密码",
        Constant.ROUTE_PARAMS_KEY.VERFIFCATION_PWD_DESC_AGAIN to "请再次输入六位数字支付密码",
        Constant.ROUTE_PARAMS_KEY.VERFIFCATION_PWD_TITLE to "请输入六位数字支付密码",
        Constant.ROUTE_PARAMS_KEY.VERFIFCATION_BUTTON to "完成"

    )
    go(RouterIndex.SEND_SMS, params)
}